import yagmail
import logging

class Tools():
    #封装日志
    def log_info(self,filename,filemode):
        logging.basicConfig(
            filename=filename,
            filemode=filemode,
            level=logging.DEBUG,
            format='%(name)s->%(levelname)s->%(dilename)s->(asctime)s'
        )

    #发送邮箱
    def send_email(self,subject,filename):
        send=yagmail.SMTP(user='1419002374@qq.com',password='pblpfajgpwcohfea',host='smtp.qq.com')
        send.send(to='1419002374@qq.com',subject=subject,contents='测试报告',attachments=filename)